import requests from '@/utils/request'
// 请求分组下的指标
export const GroupIndexes = async (group) => {
  return  requests({
    url: '/v1/datlib/gindex/indexList/',
    method: 'get',
    params: { group }
  })
}

// 请求指标的详细数据
// export const GroupIndexDetail = (giid, start=null, end=null, page=1, pageSize=100) => {
//   return  requests({
//     url: '/v1/datlib/gindex/indexDetail/',
//     method: 'get',
//     params: { giid, start, end, page, page_size: pageSize }
//   })
// }

// 提取数据
export const ExtraIndexesData = (data) => {
  return  requests({
    url: '/v1/datlib/gindex/extradb/',
    method: 'post',
    data
  })
}

// 请求指标的图形配置
// export const GroupIndexChartOption = (giid, start=null, end=null, page=1, pageSize=100) => {
//   return  requests({
//     url: '/v1/datlib/gindex/chartOption/',
//     method: 'get',
//     params: { giid, start, end, page, page_size: pageSize }
//   })
// }

// 请求堆叠图形的配置
export const GroupIndexChartOptionStack = (giid, year, start = null, end = null) => {
  return  requests({
    url: '/v1/datlib/gindex/chartOptionStack/',
    method: 'get',
    params: { giid, year, start, end }
  })
}

// 请求指标的季节图形配置
export const GroupIndexChartOptionSeason = (giid, year) => {
  return  requests({
    url: '/v1/datlib/gindex/chartOptionSeason/',
    method: 'get',
    params: { giid, year}
  })
}

// 请求区间图形配置
export const GroupIndexChartOptionInterval = (giid, year) => {
  return  requests({
    url: '/v1/datlib/gindex/chartOptionInterval/',
    method: 'get',
    params: { giid, year}
  })
}
// 增加热度记录
export const UpdateDataIndexReading = (iid) => {
  return requests({
    url: '/v1/datlib/datindex/reading/',
    method: 'post',
    data: { iid }
  })
}
export const GetDataIndexReading = () => {
  return requests({
    url: '/v1/datlib/datindex/reading/',
    method: 'get'
  })
}


export const CreateCalculateFormula = (data) => {
  return requests({
    url: '/v1/datlib/datindex/formula/',
    method: 'post',
    data,
  })
}